home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tech Arsenal 1
/
Tech Arsenal (Arsenal Computer).ISO
/
tek-02
/
swindows.zip
/
WINDCHIL.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-12-09
|
6KB
|
215 lines
{$R-,B+,S+,I+,N-}
{ Residential Building Energy Program
Wind Chill Temperature Calculation Program
March 1988 - Version 1.2 }
program WindChil;
Uses
Crt,
Input,
Dos;
Label TempInput, SpeedInput;
var
CommandData: String[15];
InError: Boolean;
i,j,
Code: Integer;
Temperature,
WindSpeed,
WindChill: Real;
procedure PaintScreen;
begin
WindChill := 0.0817 * (3.17 * Sqrt(WindSpeed) + 5.81 - 0.25 * WindSpeed) * (Temperature - 91.4) + 91.4;
GotoXY(1,8);
TextColor(LightCyan);
Write(' Dry Bulb Temperature:');
TextColor(White);
Write(Temperature:4:0);
TextColor(LightCyan);
Writeln(' degrees F');
Writeln;
Write(' Wind Speed:');
TextColor(White);
Write(WindSpeed:4:0);
TextColor(LightCyan);
Writeln(' MPH');
Writeln;
TextColor(Yellow);
Write(' Wind Chill Temperature is:');
TextColor(White);
Write(WindChill:4:0);
TextColor(Yellow);
Writeln(' degrees F');
GotoXY(1,25);
TextColor(White);
Write('<Ctrl End> ');
TextColor(LightCyan);
Write('To Exit. ');
TextColor(LightGray);
end;
begin
TextColor(LightGray);
ClrScr;
TextColor(Yellow);
Writeln(' Simple Software Solutions');
TextColor(LightCyan);
Writeln(' Wind Chill Factor Calculation Program');
Writeln(' Version 1.4 by David C. Swaim, Ph.D.');
Writeln;
Writeln;
Writeln;
if ParamCount=2 then
begin
CommandData := ParamStr(1);
Val(CommandData,Temperature,Code);
if Code<>0 then
begin
TextColor(LightRed+Blink);
Writeln;
Writeln('Temperature Must be Numeric!');
Writeln;
TextColor(Yellow);
Write('WINDCHIL ');
for i := 1 to 2 do
begin
Write(ParamStr(i),' ');
end;
Writeln;
Halt;
end
else
begin
if Temperature >= 32 then
begin
TextColor(LightRed+Blink);
Writeln;
Writeln('Temperature Must be Less than 32 Degrees!');
Writeln;
TextColor(Yellow);
Write('WINDCHIL ');
for i := 1 to 2 do
begin
Write(ParamStr(i),' ');
end;
Writeln;
Halt;
end;
end;
CommandData := ParamStr(2);
Val(CommandData,WindSpeed,Code);
if Code<>0 then
begin
TextColor(LightRed+Blink);
Writeln;
Writeln('Wind Speed Must be Numeric!');
Writeln;
TextColor(Yellow);
Write('WINDCHIL ');
for i := 1 to 2 do
begin
Write(ParamStr(i),' ');
end;
Writeln;
Halt;
end
else
begin
if WindSpeed <= 10 then
begin
TextColor(LightRed+Blink);
Writeln;
Writeln('Wind Speed Must be Greater than 10 MPH!');
Writeln;
TextColor(Yellow);
Write('WINDCHIL ');
for i := 1 to 2 do
begin
Write(ParamStr(i),' ');
end;
Writeln;
Halt;
end;
end;
PaintScreen;
end
else
begin
Temperature := 30;
WindSpeed := 20;
PaintScreen;
Numin := True;
Insrt := False;
j := 0;
While Control <> Esc do
begin
InError := False;
Case j of
0: begin
x := 39;
y := 8;
Maxin := 3;
Str(Temperature:3:0,Indata);
end;
1: begin
x := 40;
y := 10;
Maxin := 2;
Str(WindSpeed:2:0,Indata);
end;
end;
Getin(Numin,FileIn,Maxin,x,y,Indata,Insrt,Control,Number);
Case j of
0: begin
Temperature := Number;
if Temperature >= 32 then
begin
TextColor(LightRed+Blink);
GotoXY(1,25);
Write('Temperature Must be Less than 32 Degrees!');
TextColor(White);
InError := True;
end;
end;
1: begin
WindSpeed := Number;
if WindSpeed <= 10 then
begin
TextColor(LightRed+Blink);
GotoXY(1,25);
Write('Wind Speed Must be Greater than 10 MPH!');
TextColor(White);
InError := True;
end;
end;
end;
if InError then
Write(Beep)
else
begin
PaintScreen;
j := 1 - j;
end;
end;
ClrScr;
CursorOn;
end;
end.